<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>胜负彩任9组合生成器</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<div class="container">
    <!-- 头部信息 -->
    <header>
        <h1>胜负彩任9组合生成器</h1>
        <div class="issue">{{ issue }}</div>
        <div class="stats">已选择场次: <span id="selected-count">0</span> | 可生成组合数: <span id="combo-count">0</span> | 预计总注数: <span id="total-bets">0</span></div>
    </header>

    <!-- 数据链接配置区域 -->
    <div class="url-config">
        <input type="text" id="data-url" placeholder="请输入数据链接" value="{{ current_url }}">
        <button id="save-url-btn" class="btn btn-save-url">保存链接</button>
    </div>

    <!-- 操作按钮 -->
    <div class="button-group">
        <button id="refresh-btn" class="btn btn-refresh">刷新数据</button>
        <button id="generate-btn" class="btn btn-generate">生成9场组合</button>
        <button id="export-image-btn" class="btn btn-export">导出图片</button>
        <button id="clear-btn" class="btn btn-clear">清空选择</button>
    </div>

    <!-- 比赛列表区域 -->
    <div class="matches-container">
        <div class="matches-header">
            <div class="match-col col-id">序号</div>
            <div class="match-col col-league">联赛</div>
            <div class="match-col col-time">时间</div>
            <div class="match-col col-result">胜(主)</div>
            <div class="match-col col-result">平</div>
            <div class="match-col col-result">负(客)</div>
        </div>

        <div id="matches-list">
            {% for match in matches %}
            <div class="match-row" data-id="{{ match.id }}">
                <div class="match-col col-id">{{ match.id }}</div>
                <div class="match-col col-league">{{ match.league }}</div>
                <div class="match-col col-time">{{ match.time }}</div>
                <div class="match-col col-result result-3" data-result="3">
                    <div class="team">{{ match.home }}</div>
                    <div class="odds">赔率: {{ match.odds3 }}</div>
                </div>
                <div class="match-col col-result result-1" data-result="1">
                    <div class="team">平</div>
                    <div class="odds">赔率: {{ match.odds1 }}</div>
                </div>
                <div class="match-col col-result result-0" data-result="0">
                    <div class="team">{{ match.away }}</div>
                    <div class="odds">赔率: {{ match.odds0 }}</div>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>

    <!-- 组合结果区域 -->
    <div class="combinations-container">
        <h2>组合结果 <span id="combinations-count">(0组)</span></h2>
        <div id="combinations-list" class="combinations-list"></div>

        <!-- 分页控件 -->
        <div class="pagination" id="pagination">
            <button id="prev-page" class="page-btn" disabled>上一页</button>
            <span id="page-info">第 1 页 / 共 0 页</span>
            <button id="next-page" class="page-btn" disabled>下一页</button>
        </div>
    </div>

    <!-- 消息提示 -->
    <div id="toast" class="toast"></div>
</div>

<script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>
</html>